<?php
class Core_Model_Request extends Core_Model_Http_Request {

	protected $_isDispatched = false;
	
	protected $_params = array();
	
	protected $_frontName;

	protected $_controller;

	protected $_action;

	public function isDispatched() {
		return $this->_isDispatched;
	}

	public function setDispatched($disp=true) {
		$this->_isDispatched = $disp;
		return $this;
	}

	public function getFrontName() {
		return $this->_frontName;
	}

	public function setFrontName($s) {
		$this->_frontName = $s;
		return $this;
	}

	public function getControllerName() {
		return $this->_controller;
	}

	public function setControllerName($s) {
		$this->_controller = $s;
		return $this;
	}

	public function getActionName() {
		return $this->_action;
	}

	public function setActionName($s) {
		$this->_action = $s;
		return $this;
	}

    /**
     * Set route parameter
     *
     * A $value of null will unset the $key if it exists
     *
     * @param string $key
     * @param mixed $value
     * @return Core_Model_Request
     */
	public function setRouteParam($key, $val) {
		if ($val === null && isset($this->_params[$key]))
			unset($this->_params[$key]);
		else
			$this->_params[$key] = $val;
		return $this;
	}
	
	public function getRouteParam($key) {
		return isset($this->_params[$key]) ? $this->_params[$key] : null;
	}
	
	public function setRouteParams(array $data) {
		foreach($data as $k => $v)
			$this->setParam($k, $v);
	}
	
}